var sd = require("silly-datetime");

console.log(new Date());

var d = sd.format(new Date(),"YYYY-MM-DD HH:mm");
console.log(d); //2022-07-19 20:18

var dy = sd.format(new Date(),"YYYY");
console.log(dy); //2022

var y = sd.format(new Date(),"M MM");
console.log(y); //7 MM

var H = sd.format(new Date(),"H HH");
console.log(H); //20 HH 24小时制

var h = sd.format(new Date(),"h hh");
console.log(h); //8 hh 12小时制

var a = sd.format(new Date(),"a A");
console.log(a); //pm pm

var m = sd.format(new Date(),"m mm");
console.log(m); //23 mm

var s = sd.format(new Date(),"s ss");
console.log(s); //29 ss

var now = sd.fromNow(+new Date() - 2000);
console.log(now);

sd.locate({
    past: '%s之前',
    hh: '%s小時'
  });
var datetime = +new Date() + 10 * 60 * 60 * 1000;
console.log(sd.fromNow(datetime));

